/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package quanlisinhvien.dal;

import java.sql.ResultSet;
import quanlisinhvien.core.MyConnectUnit;


/**
 *
 * @author Marshmallow
 */
public class LopDAO {
    
    private MyConnectUnit conn;

    public LopDAO() {
         conn = new MyConnectUnit();
    }

    public LopDAO(MyConnectUnit conn) {
        this.conn = conn;
    }
     
    public ResultSet LayDanhSachLop(){
        try{
            return this.conn.Select("LOP");
        }
        catch(Exception ex){
            System.out.println(ex.getMessage());
            return null;
        }
    }
    
    public ResultSet LayDanhSachLopTheoKhoa(String tenKhoa){
        try{           
            return this.conn.Select("LOP, KHOA", "LOP.maKhoa = KHOA.maKhoa AND tenKhoa = '" + tenKhoa + "'");
        }
        catch(Exception ex){
            System.out.println(ex.getMessage());
            return null;
        }
    }
     
}
